<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
        <title>products</title>
    </h:head>
    <h:body>
        <h:form>
            <p:commandButton value="add new product" type='button' onclick="PF('addProduct').show();"/>
            <p:dialog widgetVar="addProduct"  width="400" height="350">
                
                <ui:include src="/WEB-INF/dialogs/newProduct.xhtml"/>
                
            </p:dialog>
            </h:form>
        <p:dataTable id="products" draggableColumns="true" emptyMessage="No Pr0oducts" var="product"
                      paginator="true" rows="100"  paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                      rowsPerPageTemplate="3,25,50,100,250,500" value="#{productCon.allProducts}">
         <p:column headerText="Product Name" sortBy="name" filterBy="name" filterMatchMode="contains"> 
             <h:outputText value="#{product.name}" /> 
                                    </p:column>
             <p:column headerText="Product Discription" sortBy="name" filterBy="name" filterMatchMode="contains"> 
                 <h:outputText value="#{product.description}" /> 
                                    </p:column>
        
        </p:dataTable>
            
            
    </h:body>
</html>

